package com.xxl.controller;

import com.xxl.dto.UserDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.hibernate.validator.constraints.Length;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotNull;
import java.io.IOException;

/**
 * 用户类Api
 * @author xxl
 * @date 2023/4/5
 */
@Validated
@Tag(name = "UserApi",description = "用户类相关的Api")
public interface UserApi<T> {
    /**
     * 退出登录
     * @return T
     */
    @Operation(summary = "退出登录接口")
    @ApiResponse(responseCode = "200",description = "退出成功")
    @ApiResponse(responseCode = "500",description = "退出失败，未知错误")
    T logout();

    /**
     * 查看自己的关注
     * @param username 当前用户
     * @return T
     */
    @Operation(summary = "查看此账户所有关注")
    @ApiResponse(responseCode = "200",description = "查询成功")
    @ApiResponse(responseCode = "500",description = "查询失败")
    @Parameter(name = "username",description = "用户名")
    T AllFollows(@NotNull String username);
    /**
     * 查看自己的粉丝
     * @param  username 当前用户
     * @return T
     */
    @Operation(summary = "查看此账户所有的粉丝")
    @ApiResponse(responseCode = "200",description = "查询成功")
    @ApiResponse(responseCode = "500",description = "查询失败")
    @Parameter(name = "username",description = "用户名")
    T AllFollowings(@NotNull String username);

    /**
     * 修改账户基本信息
     * @param userDto
     * @return T
     */
    @Operation(summary = "修改用户基本信息接口不包括密码,身份之类的,名字不可以修改")
    @ApiResponse(responseCode = "200", description = "修改成功")
    @ApiResponse(responseCode = "500", description = "修改失败")
    @Parameter(name = "userDto",description = "用户实体类对象")
    T modifyAccountInfo(@Validated UserDto userDto);

    /**
     * 修改密码
     * @param password
     * @return T
     */
    @Operation(summary = "修改账户密码")
    @ApiResponse(responseCode = "200",description = "修改成功")
    @ApiResponse(responseCode = "500",description = "修改失败")
    @Parameter(name = "password",description = "密码")
    T modifyPassword(@Length(min = 6,message = "密码最小长度不能小于6位") String password);
    /**
     * 关注别人
     * @param  followName 被关注的人名
     * @return T
     */
    @Operation(summary = "关注别人的接口")
    @ApiResponse(responseCode = "200",description = "关注成功")
    @ApiResponse(responseCode = "500",description = "关注失败")
    @Parameter(name = "followName",description = "要关注的用户名")
    T followSomeone(@NotNull String followName);
    /**
     * 取消关注
     * @param followName 被关注的人名
     * @return  T
     */
    @Operation(summary = "取消关注接口")
    @ApiResponse(responseCode = "200",description = "取消成功")
    @ApiResponse(responseCode = "500",description = "取消失败")
    @Parameter(name = "followName",description = "要取消关注的用户名")
    T cancelFollowSomeone(@NotNull String followName);

    /**
     * 上传头像
     * @param file 代处理的文件
     * @return  T
     */
    @Operation(summary = "上传头像的接口")
    @ApiResponse(responseCode = "200",description = "上传成功")
    @ApiResponse(responseCode = "500",description = "上传失败")
    @Parameter(name = "file",description = "上传的头像")
    T pictureUpload(@NotNull MultipartFile file) throws IOException;

    /**
     * 查看此账户所有的博客
     * @param
     * @return
     */
    @Operation(summary = "查询此账户的接口")
    @ApiResponse(responseCode = "200",description = "查询成功")
    @ApiResponse(responseCode = "500",description = "查询失败")
    T queryAccountAllBlog();

    /**
     * 查看当前账户用户信息
     * @param
     * @return
     */
    @Operation(summary = "查询此账户的信息")
    @ApiResponse(responseCode = "200",description = "查询成功")
    @ApiResponse(responseCode = "500",description = "查询失败")
    T lookOver();
}
